package AcWing;
import java.util.*;
public class Test {
    public static void main(String[] args) {
                Scanner scanner = new Scanner(System.in);
                int n = scanner.nextInt();
                double target = 2.0 / n;

                double max1 = Double.NEGATIVE_INFINITY;
                double max2 = Double.NEGATIVE_INFINITY;
                double max3 = Double.NEGATIVE_INFINITY;

                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < n; j++) {
                        double num = scanner.nextDouble();
                        // 更新最大的三个数
                        if (num > max1) {
                            max3 = max2;
                            max2 = max1;
                            max1 = num;
                        } else if (num > max2) {
                            max3 = max2;
                            max2 = num;
                        } else if (num > max3) {
                            max3 = num;
                        }
                    }
                }

                double sum = max1 + max2 + max3;
                if (sum >= target) {
                    System.out.println("YES");
                } else {
                    System.out.println("NO");
                }
                scanner.close();
            }
}
